<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': true} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <PerviewForm2 ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></PerviewForm2>
  </j-modal>
</template>

<script>

  import PerviewForm2 from './PerviewForm2'

  export default {
    name: 'PerviewForm',
    components: {
      PerviewForm2
    },
    data() {
      return {
        title: '操作',
        width: 700,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add() {
        this.visible = true
        this.$nextTick(() => {
          this.$refs.realForm.add()
        })
      },
      edit(record) {
        this.visible = true
        this.$nextTick(() => {
          this.$refs.realForm.edit(record)
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      submitCallback() {
        this.$emit('ok')
        this.visible = false
      },
      handleOk() {
        this.$refs.realForm.submitForm()
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>

<style lang="less" scoped>
</style>